

from enum import Enum
from typing import Literal, Tuple

class RespTypeEnum(Enum):
    success = 'success'
    error = 'error'
    warning = 'warning'

class RespEnum(Enum):
    # 成功类型
    success = ('000000','ok')
    create_success = ('000000','创建成功')
    update_success = ('000000','更新成功')
    delete_success = ('000000','删除成功')
    


class ErrTypes(Enum):
    #bad_request = dict({'code': 4000, 'msg': '客户端请求异常'})
    #unknow_error = ('9999', '未知错误')
    #bad_request = ('4000', '客户端请求异常')
    #validation_error = ('4022', '参数校验错误')
    #params_error = ('4011', '参数未知错误')

    # 错误类型
    unknown_error = ('999999', '未知错误')
    # HTTP客户请求 4001xx
    http_error = ('400199', 'HTTP请求错误')
    #bad_request = ('400100', '客户端请求异常')
    forbidden_error = ('400101', '非法请求')
    unsupported_method = ('400102', '不支持的请求方法')
    unauth_error = ('400103', '签名认证失败')
    validation_error = ('400122', '请求校验错误,请检查请求参数')
    encrption_header_error = ('400123', '加密头信息错误')
    # 原生http错误
    http_bad_request = ('400400', '客户端请求异常')
    http_unauthorized = ('400401', '客户端未认证')
    http_forbidden = ('400403', '客户端未认证')
    http_notfound = ('400404', '请求的资源不存在')
    http_method_not_allowed = ('400405', '请求方法不支持')

    # 签名/加密安全校验
    sign_validation_fail = ('400301', '签名校验失败')
    param_decryption_error = ('400302', '参数解密错误')
    param_validation_error = ('400303', '参数校验错误')
    encryption_error = ('400304', '数据加密错误')
    decryption_error = ('400305', '数据解密错误')
    unsupoorted_algo = ('400309', '签名算法不支持,请检查参数')
    #param_validation_error = ('400303', '参数校验错误')
    param_error = ('400309', '参数未知错误')

    # 业务错误 60xxxx
    bz_error = ('600001', '业务处理异常')
    bz_param_validation_error = ('600102', '业务参数校验错误')
    bz_perm_validation_error = ('600103', '业务操作权限错误')
    bz_unkown_error = ('600199', '未知业务错误')

    # fee
    fee_validate_fail = ('600201', '费率校验不通过')
    fee_unsupported_mode = ('600202', '不支持的费率模式')
    fee_not_found = ('600204', '未找到相关业务费率')
    
    # DB
    db_insert_fail = ('600301', '插入数据失败,请查检参数')
    db_update_fail = ('600302', '更新数据失败,请查检参数')
    db_record_exist = ('600303', '记录已存在')
    db_record_not_found = ('600304', '记录未找到,请查检参数')
    db_query_error = ('600305', '数据查询错误')
    db_delete_fail = ('600309', '删除失败')
    db_operation_error = ('600399', '数据库操作错误')

    # order
    trans_create_fail = ('600401', '创建订单失败')
    trans_request_error = ('600402', '交易请求错误')
    order_not_found = ('600404', '订单不存在')
    order_query_error = ('600409', '订单查询错误')

    # profit
    profit_process_error = ('600701', '分润处理错误')
    profit_insert_error = ('600705', '插入分润明细错误')
    profit_mode_error = ('600708', '分润任务模式异常')

    # channel
    chn_invalid_bank_code = ('602003', '无效的银行编码')

    # account
    acc_no_enough_balance = ('600601', '账户金额不足')
    acc_invalid_signature = ('600605', '账户金额签名异常')
    acc_adjust_fail = ('600609', '账户调账失败')

    # factor
    factor_not_found = ('600504', '代理信息有误')
    factor_status_error = ('600505', '代理状态异常')

    # risk rule
    risk_rule_not_pass = ('300199', '风控规则不通过')
    risk_error= ('300198', '风控异常错误')

    risk_ip_not_allowed= ('300102', '地址未经许可')
    risk_lack_of_params = ('300104', '风控参数缺失')

    rule_parse_error = ('300299', '风控规则解析错误')
    rule_no_func_name = ('300201', '未配置规则函数')
    rule_parse_func_error = ('300202', '规则函数解析错误')
    
    # rule error
    rule_card_over_single_limit = ('300301', '超出单笔交易限额')
    rule_card_over_day_limit = ('300302', '超出单日交易限额')
    rule_card_over_month_limit = ('300303', '超出单月交易限额')

    
    


    # 服务器异常 5000xx
    

